<template>
  <div>
    <a-card
      class="table"
      :class="{ drakTheme: route?.meta?.theme == 'dark' || drakTheme }"
    >
      <template #title v-if="title">
        <p class="title">{{ title }}</p>
        <slot name="header"></slot>
      </template>
      <template #title v-else>
        <slot name="header"></slot>
      </template>
      <slot></slot>
    </a-card>
  </div>
</template>

<script lang="ts" setup>
import { ref, defineProps, toRefs } from "vue";
import { useRoute } from "vue-router";
const route = useRoute();
const props = defineProps({
  drakTheme: Boolean,
  title: String,
});
const { title, drakTheme } = toRefs(props);
</script>
<style lang="less" scoped>
.table {
  //   表头
  /deep/ .ant-card-head {
    .ant-card-head-title {
      display: flex;
      font-size: 16px;
      .title {
        flex: 1;
        font-size: 16px;
      }
    }
    margin: 0 20px;
    padding: 0;
  }

  &.drakTheme {
    background: transparent;
    color: #fff;
    border: none;
    //   表头
    /deep/ .ant-card-head {
      color: #fff;
      border-bottom:none;
    }
  }
}
</style>
